// 距离格式化
function formatDistance (distance) {
	if (distance < 1000) {
		return `${Math.round(distance)}米`
	} else {
		return `${(distance / 1000).toFixed(1)}公里`
	}
}

// 计算时间
function formatDuration (duration) {
	const minusCost = Math.ceil(duration / 60)
	if (minusCost < 1) {
		return '1分钟'
	} else if (minusCost < 60) {
		return `${minusCost}分钟`
	} else {
		const hoursCost = Math.floor(minusCost / 60)
		const minusMode = Math.floor(minusCost % 60)
		return `${hoursCost}小时${minusMode}分钟`
	}
}

export {
	formatDistance,
	formatDuration
}
